#
# GameBackend class - encapsulates the uplink to the FGS backend.
#

from twisted.python import log

class IGameBackend(object):
    def register(self):
        """Register the proxy with the backend.  Return a deferred
        returning true if registration succeeds, false otherwise."""

    def unregister(self):
        """Unregister the proxy from the backend.  Return a deferred
        returning True if the unregistration succeeds, False
        otherwise."""

    def server_register(self, game_server):
        """Register a server as running via this proxy. Return a
        deferred returning the registered gameserver."""

    def server_unregister(self, game_server):
        """Unregister the given server from the backend. Return nothing."""

    def player_update(self, player, update_data):
        """Send the update_data key/value pairs to the backend,
        registering them as an update for the player."""

    def server_new_match(self, game_server, match):
        """Inform the backend of a new match created on the server."""

    def match_add_player(self, match, player):
        """Inform the backend that the player is now playing in the
        given match."""

    def match_remove_player(self, match, player):
        """Inform the backend that the player is no longer playing in
        the given match."""

    def match_update(self, match, match_updates, player_changes):
        """Send updated data for a match and its related players."""

    def match_end(self, match):
        """Mark the match as completed in the backend, so that future
        updates to it will fail."""

    def user_verify(self, login, token, nonce):
        """Check the authentication credentials of the user. Return a
        deferred returning true if the credentials match, or false if
        they don't."""

    def user_join(self, game_server, player, token=None, nonce=None):
        """Join the player to the given game_server. Return a deferred
        returning the joined player."""

    def user_leave(self, game_server, player):
        """Part the player from the given game_server. Return a
        deferred returning true if the remove was successful, or an
        exception otherwise."""
